<?php
session_start();
$user=isset($_SESSION["user"])?$_SESSION["user"]:null;
if(!$user){
            echo "未登录，请先登录<a href='login.html'>登录</a>"; 
}
else{
    $id = $_GET["Id"];
    $sql = "SELECT * from `article` where Id=$id";
    $conn = new mysqli("localhost","root","","myblog");
    $rs = $conn->query($sql);
    if($conn->error){
        die($conn->error);
    }
    $detail = $rs->fetch_assoc();
    if($user["Id"]!==$detail["AuthorId"]){
        die("不是作者，不可以修改");
    }
?>
<!DOCTYPE html>
<html>
    <head>
    <meta http－equiv="Content－Type" content="text/html;charset=utf-8">
        <title>文章详情</title>
    </head>
    <body>
        <form method="post" action="article_modify_do.php?Id=<?=$id ?>">
        <div>
            <label>标题</label>
            <input type="text" name="Title" value="<?=$detail["Title"]?>"/>
        </div>
        <div>
            <label>内容</label>
            <textarea name="Content"><?=$detail["Content"]?></textarea>
        </div>
        <div>
            <?=$detail["AuthorName"]?></br>编辑于
            <?=$detail["UpdateTime"]?>
        </div>
        <div>
            <input type="submit" value="提交"/>
        </div>
        <a href="article_list.php">返回列表</a>
        </form>
    </body>
</html>

<?php } ?>